package com.ruoyi.etail.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.etail.mapper.TradeDetailMapper;
import com.ruoyi.etail.domain.TradeDetail;
import com.ruoyi.etail.service.ITradeDetailService;

/**
 * 交易明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-04
 */
@Service
public class TradeDetailServiceImpl implements ITradeDetailService 
{
    @Autowired
    private TradeDetailMapper tradeDetailMapper;

    /**
     * 查询交易明细
     * 
     * @param id 交易明细主键
     * @return 交易明细
     */
    @Override
    public TradeDetail selectTradeDetailById(Long id)
    {
        return tradeDetailMapper.selectTradeDetailById(id);
    }

    /**
     * 查询交易明细列表
     * 
     * @param tradeDetail 交易明细
     * @return 交易明细
     */
    @Override
    public List<TradeDetail> selectTradeDetailList(TradeDetail tradeDetail)
    {
        return tradeDetailMapper.selectTradeDetailList(tradeDetail);
    }

    /**
     * 新增交易明细
     * 
     * @param tradeDetail 交易明细
     * @return 结果
     */
    @Override
    public int insertTradeDetail(TradeDetail tradeDetail)
    {
        tradeDetail.setCreateTime(DateUtils.getNowDate());
        return tradeDetailMapper.insertTradeDetail(tradeDetail);
    }

    /**
     * 修改交易明细
     * 
     * @param tradeDetail 交易明细
     * @return 结果
     */
    @Override
    public int updateTradeDetail(TradeDetail tradeDetail)
    {
        tradeDetail.setUpdateTime(DateUtils.getNowDate());
        return tradeDetailMapper.updateTradeDetail(tradeDetail);
    }

    /**
     * 批量删除交易明细
     * 
     * @param ids 需要删除的交易明细主键
     * @return 结果
     */
    @Override
    public int deleteTradeDetailByIds(Long[] ids)
    {
        return tradeDetailMapper.deleteTradeDetailByIds(ids);
    }

    /**
     * 删除交易明细信息
     * 
     * @param id 交易明细主键
     * @return 结果
     */
    @Override
    public int deleteTradeDetailById(Long id)
    {
        return tradeDetailMapper.deleteTradeDetailById(id);
    }
}
